import { IPortal } from './portalType'
import { TargetType } from '@/ts/core'

/** 快捷操作 */
class Operate {
  getOperateModel() {
    return this._operate()
  }

  /** 操作信息 */
  _operate(): IPortal {
    return {
      title: '快捷操作',
      extra: {
        content: '更多操作',
        afterIcon: 'tmicon-angle-right',
        size: 24
      },
      info: [
        {
          infoTitle: '添加好友',
          infoIcon: 'tmicon-md-person',
          weidetType: 'search',
          placeholder: '请输入用户的账号',
          selectTargetType: TargetType.Person
        },
        {
          infoTitle: '创建群组',
          infoIcon: 'tmicon-md-people',
          weidetType: 'formlist',
          formType: 'newGroup',
          formOption: [
            {
              name: '名称',
              type: 'input',
              required: true,
              field: 'name',
              rules: [
                {
                  required: true,
                  message: '名称不能为空'
                }
              ]
            },
            {
              name: '代码',
              type: 'input',
              required: true,
              field: 'code',
              rules: [
                {
                  required: true,
                  message: '代码不能为空'
                }
              ]
            },
            {
              name: '选择制定组织',
              type: 'select',
              required: true,
              field: 'typeName',
              rules: [
                {
                  required: true,
                  message: '不能为空'
                }
              ]
            },
            {
              name: '简介',
              type: 'input',
              required: true,
              field: 'remark',
              rules: [
                {
                  required: true,
                  message: '简介不能为空'
                }
              ]
            }
          ]
        },
        {
          infoTitle: '加入群组',
          infoIcon: 'tmicon-ios-chatbubbles',
          weidetType: 'search',
          placeholder: '请输入群组的编码',
          selectTargetType: TargetType.Cohort
        },
        {
          infoTitle: '加入单位',
          infoIcon: 'tmicon-home',
          weidetType: 'search',
          selectTargetType: TargetType.Company
        },
        {
          infoTitle: '设立单位',
          infoIcon: 'tmicon-home',
          weidetType: 'formlist',
          formType: 'newCompany',
          formOption: [
            {
              name: '名称',
              type: 'input',
              required: true,
              field: 'name',
              rules: [
                {
                  required: true,
                  message: '名称不能为空'
                }
              ]
            },
            {
              name: '企业信用代码',
              type: 'input',
              required: true,
              field: 'code',
              rules: [
                {
                  required: true,
                  message: '代码不能为空'
                }
              ]
            },
            {
              name: '类型',
              type: 'select',
              required: true,
              field: 'typeName',
              rules: [
                {
                  required: true,
                  message: '不能为空'
                }
              ]
            },
            {
              name: '简介',
              type: 'input',
              required: true,
              field: 'remark',
              rules: [
                {
                  required: true,
                  message: '简介不能为空'
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

export default new Operate()
